<%= form_for [:admin, @topic], html: { class: "card" } do |f| %>
  <div class="row row-cards row-deck">
    <div class="col-12">
      <div class="card-body">
        <h5>信息详情</h5>
        <div class="row">
          <div class="col-md-4">
            <div class="form-group">
              <label class="form-label">采购商品</label>
              <div class="form-control-plaintext"><%= @topic.name %></div>
            </div>
          </div>
          <div class="col-md-4">
            <div class="form-group">
              <label class="form-label">发布时间</label>
              <div class="form-control-plaintext"><%= formattime(@topic.created_at, unit: "hour") %></div>
            </div>
          </div>
          <% if @topic.sale_or_buy == 'sale' %>
          <div class="col-md-4">
            <div class="form-group">
              <label class="form-label">采购数量</label>
              <div class="form-control-plaintext"><%= @topic.title %></div>
            </div>
          </div>
          <% else %>
          <div class="col-md-4">
            <div class="form-group">
              <label class="form-label">采购数量</label>
              <div class="form-control-plaintext"><%= @topic.quantity %></div>
            </div>
          </div>
          <% end %>
          <div class="col-md-4">
            <div class="form-group">
              <label class="form-label">
              <% if @topic.sale_or_buy == 'sale' %>
                货品单价
              <% else %>
                货品预算
              <% end %>
              </label>
              <div class="form-control-plaintext"><%= @topic.price %></div>
            </div>
          </div>
          <div class="col-md-4">
            <div class="form-group">
              <label class="form-label">
                <% if @topic.sale_or_buy == 'sale' %>
                  发货地址
                <% else %>
                  收货地址
                <% end %>
              </label>
              <div class="form-control-plaintext"><%= @topic.province.name %><%= @topic.city.name %><%= @topic.district.name %></div>
            </div>
          </div>
          <div class="col-md-4">
            <div class="form-group">
              <label class="form-label">状态</label>
              <div class="form-control-plaintext"><%= i18n_enum @topic, :state %></div>
            </div>
          </div>

          <div class="col-md-12">
            <div class="form-group">
              <label class="form-label">描述</label>
              <div class="form-control-plaintext"><%= @topic.description %></div>
            </div>
          </div>
        </div>
        <div class="line"></div>
        <h5>关联图片</h5>
        <div class="row">
          <% @topic.topic_pictures.each do |topic_picture| %>
          <div class="col-md-4">
            <div class="card p-3">
              <a href="javascript:void(0)" class="mb-3">
                <img src="<%= topic_picture.image.url %>" class="rounded">
              </a>
            </div>
          </div>
          <% end %>
        </div>
        <div class="line"></div>
        <h5>售后处理</h5>
        <div class="row">
          <div class="col-md-12">
            <div class="form-group">
              <div class="form-label">审核</div>
              <div class="custom-controls-stacked">
                <label class="custom-control custom-radio custom-control-inline">
                  <%= f.radio_button :state, "checked", { class: "custom-control-input" } %>
                  <span class="custom-control-label">同意</span>
                </label>
                <label class="custom-control custom-radio custom-control-inline">
                  <%= f.radio_button :state, "disagree", { class: "custom-control-input" } %>
                  <span class="custom-control-label">不同意</span>
                </label>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="card-footer text-right">
        <button type="submit" class="btn btn-primary">保 存</button>
      </div>
    </div>
  </div>
<% end %>